<?

$thisMdl        = "Warehouse";
$modulNumber    = "";

$entryBoxStyle  = " style='width:110;height:40;
                           font-size:100%;
                           font-weight:bold;' ";

$GHtml       = new CGHtml;
$GJs         = new CGJavascript;
$Misc        = new Misc;
$CLFetchers  = new CLFetchers;

$SourceDb   = new Composer;
$SourceDb   = $SourceDb->init("db");

$SourceDb->add("srcDbHdr",      "MST_WAREHOUSE");
$SourceDb->add("srcDbDtl",      "MST_WAREHOUSE");

//check if the user has the entry priv
if($UID->getPrivsByNumberByNumber( $modulNumber, _ENTRY_RIGHTS) > 0){

	//check entry
	$bodyPart	=	"<tr>\n".
							"  <td> ".$GHtml->formInputButton("<font size='5'>Entry</font>", // The label
        							                           "entry",                       // var Name
        							                           "entry",                       // var value
        							                           $entryBoxStyle)." </td>\n";    // var properties
}else{

	$bodyPart	=	"<tr>\n";
}

$optPrivs = "";
if($UID->getPrivsByNumber( $modulNumber, _VIEW_RIGHTS) > 0){

	$optPrivs .=	"  <td> ".$GHtml->formInputButton("<font size='5'>View</font>", // The label
          							                           "view",                       // var Name
          							                           "View",                       // var value
          							                           $entryBoxStyle)." </td>\n";   // var properties
}
if($UID->getPrivsByNumber( $modulNumber, _MODIFY_RIGHTS) > 0){

	$optPrivs .=	"  <td> ".$GHtml->formInputButton( "<font size='5'>Modify</font>", // The label
            							                          "modify",                       // var Name
            							                          "Modify",                       // var value
            							                          $entryBoxStyle)." </td>\n";     // var properties
}
if($UID->getPrivsByNumber( $modulNumber, _EDIT_RIGHTS) > 0){

	$optPrivs	.=	"  <td> ".$GHtml->formInputButton( "<font size='5'>Delete</font>", // The label
            							                          "delete",                       // var Name
            							                          "Delete",                       // var value
            							                          $entryBoxStyle)." </td>\n";     // var properties
}

//lets init the first table
echo  $GJs->includeThis(_TYPE_CSS,"/ecs/myMenu.css").
      $GJs->includeThis(_TYPE_JS ,"/ecs/javascript/GMisc.js").
      $GJs->includeThis(_TYPE_JS ,"/ecs/javascript/GAjax.js").

      /**
      * This module js
      */
      $GJs->includeThis(_TYPE_JS ,"/ecs/tocmenu_15/javascript/misc.js").
      $GJs->includeThis(_TYPE_JS ,"/ecs/tocmenu_15/javascript/ajax.js").
      $GJs->stopRKey().

			"<br/><br/><br/><br/><br/>\n".
			"<form action=# name='crtList' method=post>\n".

			"<table border='1'>\n".
			"<form action=tocmenu_15/viewdboredit.php method=post>\n".
			$bodyPart.
			$optPrivs.
			"</td>\n".
			"</tr>\n".
			"</table>\n";

/**
* connect to db to retrieve data with system period as the range
*
*/
$Db = new oracleDb;
$Db->init($_SESSION["ORCL"],
           $_SESSION["OPASS"],
           $_SESSION["SID"],
           _NO_COMMENT);

if ($Db->connect()) {

  $srcDbHdr = "MST_WAREHOUSE";

  $CLFetchers->fetchLstTransaction($Db,
            	                     $partCriteria . $condt,
            	                     $srcDbHdr,
            	                     $nrows,
            	                     $res);

  echo  "<table border='1' class='dedeq'>\n";

  for ($i = 0; $i < $nrows; $i++) {

    switch($res["STATUS"][$i]){

      case _NOT_ACTIVE:

        $stsType = "PENDING";
        break;

      case _ACTIVE:

        $stsType = "APPROVED";
        break;

      case _CANCELED:

        $stsType = "CANCELED";
        break;

      default:
        $stsType = "ERROR!!!";
    }

    $stdPropRow = $GJs->jsOnMouseOver("GMisc.chgStyle(\"$i\",\"sBlue\");") .
                  $GJs->jsOnMouseOut ("GMisc.chgStyle(\"$i\",\"sWhite\");");

    $JID  = $res["JOB_ID"][$i];

    echo  "<tr id='$i' ".$stdPropRow.">\n".

         	  "<td> ".$GHtml->formRadio("radioview",
         	                            $JID,
         	                            _NO_PROPERTIES)."      </td>\n".

         	  "<td> ".$GHtml->formCheckBox("selbox[]",
             	                           $JID,
             	                           _NO_PROPERTIES)."  </td>\n".

          "</tr>\n";

  }

  echo  "</table>\n".
  			"<br/>\n".
  			"</form>\n".
  			"</div>\n";

  $Db->dc();
}else{

  $Misc->usrDie("DB connection failed");
}

session_commit();

?>